<?php
class Text extends Element{
	
	private $authorizedElements = array();
	
	private $italic;
	
	private $bold;
	
	private $underline;
	
	private $text;
	
	public function __construct($text ='', $italic = false, $bold = false, $underline = false){
		parent::__construct($this->authorizedElements);
		$this->text = $text;
		$this->italic = $italic;
		$this->bold = $bold;
		$this->underline = $underline;
	}
	
	public function get_text(){
		return $this->text;
	}
	
	public function __toString(){
		if ($this->italic) $text = '<i>';
		if ($this->bold) $text = '<b>';
		if ($this->underline) $text = '<u>';
        (isset($text))? $text .= $this->text : $text = $this->text;
		if ($this->italic) $text .= '</i>'; 
		if ($this->bold) $text .= '</b>';
		if ($this->underline) $text .= '</u>';
        
		$text.= parent::__toString();
		return $text;
    }
}
?>